package com.mvc4g.example.client.company.actions;

import com.mvc4g.client.ActionInterface;
import com.mvc4g.client.Controller;
import com.mvc4g.client.Event;
import com.mvc4g.example.client.Constants;
import com.mvc4g.example.client.company.CompanyBean;
import com.mvc4g.example.client.company.views.DisplayCompanyView;

public class CreateCompanyAction implements ActionInterface, Constants {

	@Override
	public void execute(Controller controller, Object form) {
		CompanyBean company = (CompanyBean) form;
		DisplayCompanyView createView = (DisplayCompanyView) controller
				.getView(DISPLAY_VIEW);
		controller.handleEvent(new Event(CHANGE_PAGE, createView));
		controller.handleEvent(new Event(SHOW_MESSAGE, "Company Creation Succeeded"));
		createView.init(company);
	}

}
